<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>指尖改变世界 - 科技始终来源于人性</title><meta name="keywords" content="沙屿沫个人博客,沙屿沫,shayvmo,php"><meta name="author" content="沙屿沫"><meta name="copyright" content="沙屿沫"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="科技始终来源于人性">
<meta property="og:type" content="website">
<meta property="og:title" content="指尖改变世界">
<meta property="og:url" content="http://blog.shayvmo.cn/page/5/index.html">
<meta property="og:site_name" content="指尖改变世界">
<meta property="og:description" content="科技始终来源于人性">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://blog.shayvmo.cn/images/avatar.jpg">
<meta property="article:author" content="沙屿沫">
<meta property="article:tag" content="沙屿沫个人博客,沙屿沫,shayvmo,php">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://blog.shayvmo.cn/images/avatar.jpg"><link rel="shortcut icon" href="/images/avatar.jpg"><link rel="canonical" href="http://blog.shayvmo.cn/page/5/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?5e4d1e8fcc524b4e732ea58fa9fa15f0";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '指尖改变世界',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2023-06-05 17:19:25'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><meta name="generator" content="Hexo 5.4.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src= "" data-lazy-src="/images/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">74</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">42</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">15</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('/images/bg/kobe.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">指尖改变世界</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">指尖改变世界</h1><div id="site-subtitle"><span id="subtitle"></span></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/06/05/composer-exhaust/" title="composer require 拓展包时，出现内存溢出">     <img class="post_bg" src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="composer require 拓展包时，出现内存溢出"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/05/composer-exhaust/" title="composer require 拓展包时，出现内存溢出">composer require 拓展包时，出现内存溢出</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-05T07:14:14.000Z" title="发表于 2020-06-05 15:14:14">2020-06-05</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/PHP/">PHP</a></span></div><div class="content">Composer 安装包基于 php 来执行，所有当出现内存溢出时，只要调整 php 的内存限制即可。
想要突破 php 的内存限制，可以通过修改配置文件或在执行 composer 命令时动态修改。
建议在 composer require 时，临时动态调整 php 的内存限制，命令如下：
// 在 composer 命令前添加php -d memory_limit=-1 /usr/local/bin/composer require [your pakage]// 示例php -d memory_limit=-1 /usr/local/bin/composer require &quot;overtrue/laravel-filesystem-qiniu&quot; -vvv
</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/06/04/git-webhook/" title="宝塔使用 git + webhooks 实现服务器同步">     <img class="post_bg" src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="宝塔使用 git + webhooks 实现服务器同步"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/04/git-webhook/" title="宝塔使用 git + webhooks 实现服务器同步">宝塔使用 git + webhooks 实现服务器同步</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-04T07:47:45.000Z" title="发表于 2020-06-04 15:47:45">2020-06-04</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%85%B6%E4%BB%96/">其他</a></span></div><div class="content">我们在开发项目的时候，push到git服务器后，我们可能还需要同步更新到线上服务器。
但是这一步骤往往比较麻烦，算是重复工作的一部分了，这时候我们就可以利用 钩子 来实现，自动同步项目代码
【事先准备】1、git仓库，可以是 github ，gitee，也可以是自建的 gitea, gogs
2、安装好 宝塔 的服务器
3、安装好 git 的服务器，未安装的可以先安装 yum install git
已安装的，可以通过git --version查看版本
各个 git 托管仓库的 webhooks 大同小异，以下以 码云gitee 为例，进行流程讲述。
【流程】1、为当前服务器生成公钥登录到服务器，输入 ssh-keygen -t ras 命令，一路回车即可。


2、添加公钥到码云项目
3、进入服务器，web目录，首次克隆仓库cd /www/wwwroot# 方法一： 使用ssh git clone git@gitee.com:shayvmo/test-webhook.git# 方法二： 使用httpsgit clone https://gitee.com/shayvmo/test-w ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/06/04/bt-laravel/" title="宝塔部署 laravel 项目踩坑">     <img class="post_bg" src= "" data-lazy-src="/images/laravel/laravel.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="宝塔部署 laravel 项目踩坑"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/06/04/bt-laravel/" title="宝塔部署 laravel 项目踩坑">宝塔部署 laravel 项目踩坑</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-06-04T07:04:58.000Z" title="发表于 2020-06-04 15:04:58">2020-06-04</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/PHP/">PHP</a></span></div><div class="content">宝塔部署 laravel 项目，访问出现路由失效 404 
查看网站配置后，修改相应的伪静态配置文件即可。
也可以直接在设置那里选择 laravel 的重写规则。
location / &#123;    try_files $uri $uri/ /index.php?$query_string; #开启路由访问，laravel项目改为此条&#125;



</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/05/27/python-list/" title="python 序列在 for 循环需要注意的点">     <img class="post_bg" src= "" data-lazy-src="/images/python.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="python 序列在 for 循环需要注意的点"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/27/python-list/" title="python 序列在 for 循环需要注意的点">python 序列在 for 循环需要注意的点</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-27T01:46:26.000Z" title="发表于 2020-05-27 09:46:26">2020-05-27</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%85%B6%E4%BB%96/">其他</a></span></div><div class="content">复合语句是包含其它语句（语句组）的语句；它们会以某种方式影响或控制所包含其它语句的执行。 通常，复合语句会跨越多行，虽然在某些简单形式下整个复合语句也可能包含于一行之内。
if, while 和 for 语句用来实现传统的控制流程构造。
for 语句中执行 list 的 remove 操作时，会有一个很微妙的问题。如下：
【问题】#示例1，会打印出 1 2 a = [1,2,3,1,2,4,5]for i in a:    a.remove(i)    for j in a:        if(i==j):            print(j) #示例2，只会打印出 1a = [1,2,3,1,4,2,5]for i in a:    a.remove(i)    for j in a:        if(i==j):            print(j) 

上述2个示例中，我们想要达到的预期效果是找出list a 中的重复元素。但是为什么示例1可以打印出2个重复元素，示例2只能打印出1个重复元素呢？
【分析】Python 中 for 语句用于序列或其他可迭代对象中的元素进行 ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/05/25/git-flow/" title="git-flow 在团队中的实践">     <img class="post_bg" src= "" data-lazy-src="/images/git.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="git-flow 在团队中的实践"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/25/git-flow/" title="git-flow 在团队中的实践">git-flow 在团队中的实践</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-25T07:43:29.000Z" title="发表于 2020-05-25 15:43:29">2020-05-25</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%85%B6%E4%BB%96/">其他</a></span></div><div class="content">文档规范在一个高效的团队里面必不可少。工作上，我们也从起初的 SVN 转到了 Git 工具上。
Git 作为出色的项目版本管理工具，究竟有什么优点，该如何使用？下面我们来一一说明。
【介绍】Git 是一个开源高效的分布式版本管理工具，相比 SVN 集中式工具，最大的特点是，Git 在每个本地都是一个完整的版本库，各自处理版本开发，开发完成后，再推送到远程的主库
不同的开发人员，再分别拉取各自的更新即可。
【常用分支】master: 主分支，也就是产品分支，这个分支保持和线上的代码完全一致。该分支最为稳定功能最为完整的随时可发布的代码
develop : 开发分支，包含所有下一个版本的开发代码，也是团队人员需要保持最新版本的分支，也是功能最新最全的分支
feature/* : 功能分支。基于 develop 分支，每个功能单独建立一个分支，例如：feature/user-add，完成时，合并到 develop 分支，合并完成后，删除或保留分支 
bugfix/* : bug 修复分支，基于 develop 分支的修复不紧急的 bug 。对于一些完成的功能未上线且已经合并到了 develo ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/05/20/vagrant-box-1/" title="导入 vagrant-box 到 vagrant 里面">     <img class="post_bg" src= "" data-lazy-src="/images/vagrant-box/1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="导入 vagrant-box 到 vagrant 里面"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/20/vagrant-box-1/" title="导入 vagrant-box 到 vagrant 里面">导入 vagrant-box 到 vagrant 里面</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-20T10:28:50.000Z" title="发表于 2020-05-20 18:28:50">2020-05-20</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span></div><div class="content">vagrant安装好 vagrant ， 下载相应的 vagrant box 
初次导入 box 到全局vagrant ，供创建 vagrant 新容器 时使用
【步骤】
1、下载安装 vagrant
https://www.virtualbox.org/
2、下载 vagrant box
参考： http://blog.shayvmo.top/2020/05/20/vagrant-box/
3、将 box 导入到 vagrant 
vagrant box add 名称 box路径
vagrant box add bbc/centos65 /data/vm/commerce_b2b2c-lnmp-with-prism-0.0.2.box
4、创建新的 vagrant 容器
vagrant init bbc/centos65
启动 vagrant 容器
vagrant up
</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/05/20/vagrant-box/" title="vagrant的box哪里下？找不到镜像？教你如何优雅地下载各种box资源">     <img class="post_bg" src= "" data-lazy-src="/images/vagrant-box/1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="vagrant的box哪里下？找不到镜像？教你如何优雅地下载各种box资源"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/20/vagrant-box/" title="vagrant的box哪里下？找不到镜像？教你如何优雅地下载各种box资源">vagrant的box哪里下？找不到镜像？教你如何优雅地下载各种box资源</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-20T09:52:38.000Z" title="发表于 2020-05-20 17:52:38">2020-05-20</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span></div><div class="content">每当有小伙伴搭建 vagrant 环境的时候，总是苦于 box 镜像怎么下载。（其实我一开始也找不到）
各种度娘之后，终于找到了一种方式，可以优雅地下载需要的 box 镜像啦
很感谢开源中国的 cxgphper  提供的方式
话不多说进入主题
【步骤】1、进入 vagrantup 官网，点击 Find Boxes ， 进入 box列表页
2、点击进入需要下载的box详情页
3、点击选择版本
4、 这时候网站地址栏会拼接上相应版本号，这时，不多说，开始拼接URLhttps://app.vagrantup.com/centos/boxes/7/versions/2004.01/providers/供应商名字.box
【示例下载链接】https://app.vagrantup.com/centos/boxes/7/versions/2004.01/providers/virtualbox.box
【链接解析】https://app.vagrantup.com/box名称前半部分/boxes/box名称后半部分/versions/版本号/providers/供应商名字.box
</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/05/20/vue-admin-template/" title="基于 vue-element-admin 基础模板实现侧边栏菜单动态渲染">     <img class="post_bg" src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="基于 vue-element-admin 基础模板实现侧边栏菜单动态渲染"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/20/vue-admin-template/" title="基于 vue-element-admin 基础模板实现侧边栏菜单动态渲染">基于 vue-element-admin 基础模板实现侧边栏菜单动态渲染</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-20T07:02:09.000Z" title="发表于 2020-05-20 15:02:09">2020-05-20</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%89%8D%E7%AB%AF/">前端</a></span></div><div class="content">码云仓库地址： https://gitee.com/shayvmo/vue-element-template
该仓库已删除，可以查看新仓库：https://gitee.com/shayvmo/vue-elemnt-admin
基于 vue-admin-template 基础模板实现动态生成侧边栏菜单
【思路】获取用户信息的时候，把后端返回的路由保存在 store 里面，执行生成路由时，合并前端静态定义的路由以及后端获取回来的动态路由
【主要修改文件】src/permission.js src/store/modules/permission.js utils/_import.js utils/router.js

文件： src/permission.js
获取用户信息，存储路由
const &#123; roles &#125; = await store.dispatch(&#39;basic/getInfo&#39;)
合并路由，渲染路由
const accessRoutes = await store.dispatch(&#39;permission/generateRoute ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/05/19/postman-1/" title="postman 实用小技巧 - 登录设置token">     <img class="post_bg" src= "" data-lazy-src="/images/postman/postman.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="postman 实用小技巧 - 登录设置token"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/19/postman-1/" title="postman 实用小技巧 - 登录设置token">postman 实用小技巧 - 登录设置token</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-19T01:39:00.000Z" title="发表于 2020-05-19 09:39:00">2020-05-19</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%85%B6%E4%BB%96/">其他</a></span></div><div class="content">日常在使用 postman 进行接口调试时，难免会先登录后，再附加 token 进行另外接口的调试。
每次请求接口后，会有相应的数据返回；在某些场景需要用到另一个接口的返回值，比如API带token进行请求地址。
在这种情况下，可以将最初请求接口返回的token数据，设置为环境变量或全局变量，便于下次直接调用，不用每次都请求一遍接口获取token
而且获取新token后也不用每次都手动输入。
【步骤】
1、把返回来的json字符串转换成json对象。
JsonData=JSON.parse(responseBody);
2、设置成变量名为token的环境变量
pm.environment.set(&quot;token&quot;, JsonData.session_key);
设置环境变量，全局变量可以自由按照项目需求进行设置。
一般情况下，有多个项目时，同一个项目的变量设置到同一个环境下，通用的变量设置到全局变量即可。
在调用变量的时候，用  方式进行变量读取即可。图中的请求地址，就是直接调用环境变量中的 url_base 。

</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/05/18/goland/" title="goland 下载与安装">     <img class="post_bg" src= "" data-lazy-src="/images/goland.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="goland 下载与安装"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/05/18/goland/" title="goland 下载与安装">goland 下载与安装</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2020-05-18T10:15:52.000Z" title="发表于 2020-05-18 18:15:52">2020-05-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Go/">Go</a></span></div><div class="content">【原文链接】
Goland 2019下载和安装
</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/page/4/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/4/#content-inner">4</a><span class="page-number current">5</span><a class="page-number" href="/page/6/#content-inner">6</a><span class="space">&hellip;</span><a class="page-number" href="/page/8/#content-inner">8</a><a class="extend next" rel="next" href="/page/6/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src= "" data-lazy-src="/images/avatar.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">沙屿沫</div><div class="author-info__description">科技始终来源于人性</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">74</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">42</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">15</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/shayvmo"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">生活就像海洋，只有意志坚强的人才能到达彼岸。</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/06/05/webman-route-annotation/" title="webman 框架 注解路由插件"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="webman 框架 注解路由插件"/></a><div class="content"><a class="title" href="/2023/06/05/webman-route-annotation/" title="webman 框架 注解路由插件">webman 框架 注解路由插件</a><time datetime="2023-06-05T07:04:07.000Z" title="发表于 2023-06-05 15:04:07">2023-06-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/29/nginx-reload-not-effect/" title="windows服务器重载nginx配置无效"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="windows服务器重载nginx配置无效"/></a><div class="content"><a class="title" href="/2023/05/29/nginx-reload-not-effect/" title="windows服务器重载nginx配置无效">windows服务器重载nginx配置无效</a><time datetime="2023-05-29T08:03:45.000Z" title="发表于 2023-05-29 16:03:45">2023-05-29</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/05/24/php-aes/" title="前后端接口传输AES加密"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="前后端接口传输AES加密"/></a><div class="content"><a class="title" href="/2023/05/24/php-aes/" title="前后端接口传输AES加密">前后端接口传输AES加密</a><time datetime="2023-05-24T07:00:39.000Z" title="发表于 2023-05-24 15:00:39">2023-05-24</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/08/16/yar-demo/" title="Yar拓展，实现PHP的RPC服务"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Yar拓展，实现PHP的RPC服务"/></a><div class="content"><a class="title" href="/2022/08/16/yar-demo/" title="Yar拓展，实现PHP的RPC服务">Yar拓展，实现PHP的RPC服务</a><time datetime="2022-08-16T09:30:43.000Z" title="发表于 2022-08-16 17:30:43">2022-08-16</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/08/15/my-online-log/" title="线上日志系统"><img src= "" data-lazy-src="/images/code.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="线上日志系统"/></a><div class="content"><a class="title" href="/2022/08/15/my-online-log/" title="线上日志系统">线上日志系统</a><time datetime="2022-08-15T09:03:01.000Z" title="发表于 2022-08-15 17:03:01">2022-08-15</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            <a class="card-more-btn" href="/categories/" title="查看更多">
    <i class="fas fa-angle-right"></i></a>
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Go/"><span class="card-category-list-name">Go</span><span class="card-category-list-count">4</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Hexo/"><span class="card-category-list-name">Hexo</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Java/"><span class="card-category-list-name">Java</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Linux/"><span class="card-category-list-name">Linux</span><span class="card-category-list-count">9</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Memcached/"><span class="card-category-list-name">Memcached</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/MySQL/"><span class="card-category-list-name">MySQL</span><span class="card-category-list-count">3</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/PHP/"><span class="card-category-list-name">PHP</span><span class="card-category-list-count">23</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Redis/"><span class="card-category-list-name">Redis</span><span class="card-category-list-count">1</span></a></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tags/AES/" style="font-size: 1.1em; color: #999">AES</a> <a href="/tags/Apache/" style="font-size: 1.1em; color: #999">Apache</a> <a href="/tags/Curl/" style="font-size: 1.1em; color: #999">Curl</a> <a href="/tags/Go/" style="font-size: 1.37em; color: #99a4b2">Go</a> <a href="/tags/Hexo/" style="font-size: 1.37em; color: #99a4b2">Hexo</a> <a href="/tags/Laravel/" style="font-size: 1.1em; color: #999">Laravel</a> <a href="/tags/Linux/" style="font-size: 1.1em; color: #999">Linux</a> <a href="/tags/MD5/" style="font-size: 1.1em; color: #999">MD5</a> <a href="/tags/MySQL/" style="font-size: 1.37em; color: #99a4b2">MySQL</a> <a href="/tags/Nginx/" style="font-size: 1.23em; color: #999ea6">Nginx</a> <a href="/tags/PHP/" style="font-size: 1.5em; color: #99a9bf">PHP</a> <a href="/tags/Paypal/" style="font-size: 1.1em; color: #999">Paypal</a> <a href="/tags/PhpStorm/" style="font-size: 1.1em; color: #999">PhpStorm</a> <a href="/tags/Python/" style="font-size: 1.1em; color: #999">Python</a> <a href="/tags/RESTfulAPI/" style="font-size: 1.1em; color: #999">RESTfulAPI</a> <a href="/tags/RPC/" style="font-size: 1.1em; color: #999">RPC</a> <a href="/tags/Redis/" style="font-size: 1.1em; color: #999">Redis</a> <a href="/tags/SVN/" style="font-size: 1.1em; color: #999">SVN</a> <a href="/tags/Ubuntu/" style="font-size: 1.37em; color: #99a4b2">Ubuntu</a> <a href="/tags/Vagrant/" style="font-size: 1.23em; color: #999ea6">Vagrant</a> <a href="/tags/Websocket/" style="font-size: 1.1em; color: #999">Websocket</a> <a href="/tags/Yii/" style="font-size: 1.1em; color: #999">Yii</a> <a href="/tags/composer/" style="font-size: 1.1em; color: #999">composer</a> <a href="/tags/element/" style="font-size: 1.23em; color: #999ea6">element</a> <a href="/tags/git/" style="font-size: 1.1em; color: #999">git</a> <a href="/tags/jquery/" style="font-size: 1.1em; color: #999">jquery</a> <a href="/tags/memcached/" style="font-size: 1.1em; color: #999">memcached</a> <a href="/tags/postman/" style="font-size: 1.1em; color: #999">postman</a> <a href="/tags/sitemap/" style="font-size: 1.1em; color: #999">sitemap</a> <a href="/tags/thinkphp6/" style="font-size: 1.1em; color: #999">thinkphp6</a> <a href="/tags/vue/" style="font-size: 1.1em; color: #999">vue</a> <a href="/tags/webhooks/" style="font-size: 1.1em; color: #999">webhooks</a> <a href="/tags/webman/" style="font-size: 1.1em; color: #999">webman</a> <a href="/tags/%E5%85%AC%E4%BC%97%E5%8F%B7%E8%B0%83%E8%AF%95%E5%99%A8/" style="font-size: 1.1em; color: #999">公众号调试器</a> <a href="/tags/%E5%86%92%E6%B3%A1%E6%8E%92%E5%BA%8F/" style="font-size: 1.1em; color: #999">冒泡排序</a> <a href="/tags/%E5%8D%9A%E5%AE%A2%E8%BF%81%E7%A7%BB/" style="font-size: 1.1em; color: #999">博客迁移</a> <a href="/tags/%E5%9B%BE%E7%89%87%E8%BD%ACbase64/" style="font-size: 1.1em; color: #999">图片转base64</a> <a href="/tags/%E5%B7%A5%E5%85%B7/" style="font-size: 1.1em; color: #999">工具</a> <a href="/tags/%E5%B9%82%E7%AD%89/" style="font-size: 1.1em; color: #999">幂等</a> <a href="/tags/%E6%B3%9B%E5%9E%8B/" style="font-size: 1.1em; color: #999">泛型</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span><a class="card-more-btn" href="/archives/" title="查看更多">
    <i class="fas fa-angle-right"></i></a></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/06/"><span class="card-archive-list-date">六月 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/05/"><span class="card-archive-list-date">五月 2023</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/08/"><span class="card-archive-list-date">八月 2022</span><span class="card-archive-list-count">4</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/06/"><span class="card-archive-list-date">六月 2022</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/05/"><span class="card-archive-list-date">五月 2022</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/01/"><span class="card-archive-list-date">一月 2022</span><span class="card-archive-list-count">6</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/09/"><span class="card-archive-list-date">九月 2021</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/08/"><span class="card-archive-list-date">八月 2021</span><span class="card-archive-list-count">1</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">74</div></div><div class="webinfo-item"><div class="item-name">已运行时间 :</div><div class="item-count" id="runtimeshow" data-publishDate="2019-08-27T16:00:00.000Z"></div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">30.9k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2023-06-05T09:19:25.031Z"></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/images/bg/kobe.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2023 By 沙屿沫</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a href="http://www.beian.miit.gov.cn/" target="_blank" rel="noopener"><img class="icp-icon" src= "" data-lazy-src="/images/icp.png"><span>粤ICP备18133330号</span></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>function subtitleType () {
  if (true) { 
    var typed = new Typed("#subtitle", {
      strings: "生活就像海洋，只有意志坚强的人才能到达彼岸".split(","),
      startDelay: 300,
      typeSpeed: 150,
      loop: true,
      backSpeed: 50
    })
  } else {
    document.getElementById("subtitle").innerHTML = '生'
  }
}

if (true) {
  if (typeof Typed === 'function') {
    subtitleType()
  } else {
    getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
  }
} else {
  subtitleType()
}</script></div><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="false"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="click-show-text" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js" data-mobile="false" data-text="富强,民主,文明,和谐,自由,平等,公正,法治,爱国,敬业,诚信,友善" data-fontsize="15px" data-random="false" async="async"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>